﻿// See https://aka.ms/new-console-template for more information
using System.Net;
using System.Net.Http.Json;
using XSC.KN;
using XSC.KN.Core.KNObjects;
using XSC.KN.Core.KNObjects.Blocks;

//var _httpClient = new HttpClient();
////_httpClient.BaseAddress = new Uri("http://localhost:10003/");
//_httpClient.BaseAddress = new Uri("https://bms-api.camsl.com/changan-api-new/");
//_httpClient.DefaultRequestHeaders.Add("Accept", "application/json");

//var prjIds = new int[] {
//744,
//745,
//746,
//747,
//748,
//749,
//750,
//751,
//752,
//753,
//754,
//755,
//756,
//757,
//758,
//759,
//760,
//761,
//762,
//763,
//764,
//765,
//766,
//767,
//768,
//769,
//770,
//771,
//772,
//773,
//774,
//775,
//776,
//777,
//778,
//779,
//780,
//781,
//782,
//783,
//784,
//785,
//786,
//787,
//788,
//789,
//790,
//791,
//792,
//793,
//794,
//795,
//796,
//797,
//798,
//799
//};
//foreach (var prj in prjIds)
//{
//    try
//    {
//        Console.WriteLine(prj);
//        var appConfig = new xx() { projectId = prj, contractId = 539 };
//        await _httpClient.PostAsJsonAsync("basicapi/project/createcontractreleation", appConfig);
//    }
//    catch (Exception ex)
//    {
//        Console.WriteLine(ex.ToString());
//    }

//}


Console.WriteLine("Hello, World!");

var testBlock = new Knowledge()
{
    Title = "1",
    CreatedOn = DateTime.Now,
    UpdatedOn = DateTime.Now,
    CreatedBy = "1",
    Blocks = new KNBlockCollection() {
        new KNBlock() {
            Type = TextBlock.Type,
            Data = new TextBlock() {
                Text = "12312"
            }
        }
    }
};

var t1 = testBlock.ToJson();
var t2 = t1.ToKnowledge();
Console.WriteLine("hello");
public class xx
{
    public int projectId { get; set; }
    public int contractId { get; set; }
}